Devers faced his former team five days after the shocking trade that sent him to San Francisco, going 0 for 5. He got a standing ovation before grounding out in his first at-bat in the first inning and hit a drive to the wall in left-center that Rafaela caught against the wall.
Brennan Bernardino (3-2) pitched a scoreless inning for the win and Aroldis Chapman pitched the ninth for his 14th save in 15 chances.
Wilyer Abreu hit an RBI single in the seventh for an insurance run in his first game off the injured list.
The Giants scored four runs in the first four innings on a pair of run-scoring double plays hit into by Christian Koss, an error by second baseman David Hamilton and an RBI single by Mike Yastrzemski on a comebacker off Hunter Dobbins.
But the Red Sox took a 5-4 lead thanks to a two-run homer by Hamilton, RBI singles by Rafaela and Roman Anthony and an error by Koss at second base.
Wilmer Flores tied the game at 5 with an RBI single in the fifth.
Key moment
The Giants loaded the bases with two outs in the eighth, but Garrett Whitlock struck out Yastrzemski to preserve the 7-5 lead.
Key stat
Red Sox relievers combined for five scoreless innings and have allowed no runs in 17 2-3 innings over the last five games.
Up next
RHP Brayan Bello (3-1, 3.49 ERA) will start for Boston against RHP Landon Roupp (4-5, 3.99).
___
AP MLB: https://apnews.com/hub/MLB
Credit: AP
Credit: AP
Credit: AP
Credit: AP
Credit: AP
Credit: AP